button 按钮
更新时间:2023-06-20
button 按钮
按钮
属性说明
属性名 | 类型 | 必填 | 默认值 | 说明 |
---|---|---|---|---|
size | String | 否 | normal | normal:标准尺寸,small:较小尺寸 |
type | String | 否 | real | real;real2;ghost;flat;custom:自由定义 |
class-name | String | 否 | 无 | 自定义 class |
disabled | Boolean | 否 | false | 是否禁用 |
text | String | 否 | false | 按钮上的文字 |
loading | Boolean | 否 | false | 是否加载中 |
open-type | String | 否 | 无 | 车载小程序开放能力,比如分享、获取用户信息等等。 |
bindgetphonenumber | EventHandler | 否 | 无 | 获取用户手机号回调。和 open-type 搭配使用, 使用时机:open-type="getPhoneNumber"。 |
bindgetuserinfo | EventHandler | 否 | 无 | 用户点击该按钮时,会返回获取到的用户信息,从返回参数的 detail 中获取到的值,和 swan.getUserInfo 一样的。和 open-type 搭配使用, 使用时机: open-type="getUserInfo" |
bindlogin | EventHandler | 否 | 无 | 登录回调,和 open-type 搭配使用,使用时机:open-type="login"。可以通过返回参数的 detail 判断是否登录成功,当 errMsg 为'login:ok'时即为成功。如想获取登录凭证请使用 swan.getLoginCode |
bindcontact | EventHandler | 否 | 无 | 客服消息回调,使用时机:open-type="contact" |
bindopensetting | EventHandler | 否 | 无 | 在打开授权设置页后回调,使用时机:open-type="openSetting" |
bindchooseaddress | EventHandler | 否 | 无 | 用户点击该按钮时,调起用户编辑收货地址原生界面,并在编辑完成后返回用户选择的地址,从返回参数的 detail 中获取,和 swan.chooseAddress 一样的。和 open-type 搭配使用,使用时机:open-type="chooseAddress" |
示例
json:
{
"usingComponents": {
"iov-button": "iov-ui/lib/button"
}
}
swan:
<view>
<iov-button text="确认"></iov-button>
<iov-button loading="true" text="确认"></iov-button>
<iov-button text="确认确认确认确认确认"></iov-button>
<iov-button disabled="true" text="确认"></iov-button>
<iov-button size="small" disabled="true" text="确认"></iov-button>
<iov-button size="small" disabled="true">abc</iov-button>
</view>
js:
Page({});